/*
 * File name: ChildrenVoiceSettingItem.java
 * 
 * Description: the setting item of children voice, rotate layout
 *
 * Author: Theobald_wu, contact with wuqizhi@tydtech.com
 * 
 * Date: 2014-11-10   
 * 
 * Copyright (C) 2014 TYD Technology Co.,Ltd.
 * 
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.freeme.cameraplugin.childrenmode;

import android.content.Context;
import android.content.res.Configuration;
import android.util.AttributeSet;
import android.widget.RelativeLayout;

public class ChildrenVoiceSettingItem extends RelativeLayout implements Rotatable {
    private static final String TAG = "[FREEME_DBG]childrenVoiceSettingItem";

    public ChildrenVoiceSettingItem(Context context) {
        super(context);
    }

    public ChildrenVoiceSettingItem(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void setOrientation(int orientation, boolean animation) {
        int screenOri = getResources().getConfiguration().orientation;

        android.util.Log.i(TAG, "setOrientation(): orientation = " + orientation);
        if (Configuration.ORIENTATION_LANDSCAPE == screenOri) {
            if (orientation % 180 == 0) {
                setRotation(orientation + 180);
            } else {
                setRotation(orientation);
            }
        } else {
            setRotation(-orientation);
        }
    }
}
